import { articleCategoryGet } from '@/api/article.js'

// vuex 用户管理文章相关数据的仓库
export default {
  namespaced: true,
  state: {
    // data(){return {list:[]}}
    artCateList: []
  },
  mutations: {
    setArtCateList (state, artCateList) {
      state.artCateList = artCateList
    }
  },
  actions: {
    async getArtCateList (context) {
      const { data: { code, message, data = [] } } = await articleCategoryGet()
      if (code !== 0) return console.log('文章分类数据请求fail')
      console.log(message)
      console.log(data)
      context.commit('setArtCateList', data)
    }
  }
}
